package linz

import java.lang.IllegalArgumentException

/**
 * TODO 异常处理和自定义异常特点
 */

const val TAG = ""


fun main() {
    // TODO 自定义异常
//    try {
//        var info: String? = null
//        checkException(info)
//        println(info!!.length)
//    }catch (e:Exception){
//        println("啊呀: $e")
//    }

    // TODO 先决条件
    var value1 :String ? = null
    var value2 :Boolean = false
//    checkNotNull(value1) //Exception in thread "main" java.lang.IllegalStateException: Required value was null.
//    requireNotNull(value1) //Exception in thread "main" java.lang.IllegalArgumentException: Required value was null.


}

fun checkException(info:String?){
    info?: throw CustomException()
}

class CustomException : IllegalArgumentException("特殊异常问题，请及时忽略")